﻿package tests;
import haxe.Timer;
import fpc.controls.buttons.Button;
import fpc.containers.Container;
import fpc.ALayoutable;
import fpc.layouts.CanvasLayout;
import fpc.layouts.ILineLayout;

class CanvasTest extends GenericTest
{
	public function new() 
	{
		super();
	}
	
	override function init()
	{
		var container = new Container<ILineLayout>(new CanvasLayout());
		container.addTo(this);
		var layout = container.layout;
		layout.autoSize = false;
		
		var button = new Button('Button 0');
		button.x = 10;
		button.y = 20;
		button.percentsWidth = 100;
		layout.add(button);
		
		var button = new Button('Button 1');
		button.x = 10;
		button.y = 50;
		button.percentsWidth = 50;
		layout.add(button);
		
		container.width = 200;
		container.height = 500;
		
		_target = button;
		Timer.delay(onTimer, 1000);
	}
	
	var _target:ALayoutable;
	
	function onTimer()
	{
		_target.x = 150;
	}
}